namespace Ds.DataBase.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddNewMyKaoHeBiao : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.MyKaoHeBiaos",
                c => new
                    {
                        mkhbid = c.Int(nullable: false, identity: true),
                        cjsj = c.DateTime(nullable: false),
                        sssj = c.DateTime(nullable: false),
                        username = c.String(),
                        khbzt = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.mkhbid);
            
            CreateTable(
                "dbo.MyKaoHeBiao_fujiaxiang",
                c => new
                    {
                        fjxid = c.Int(nullable: false, identity: true),
                        xmid = c.Int(nullable: false),
                        xmmc = c.String(),
                        xmfz = c.String(),
                        cjrusername = c.String(),
                        MyKaoHeBiao_mkhbid = c.Int(),
                    })
                .PrimaryKey(t => t.fjxid)
                .ForeignKey("dbo.MyKaoHeBiaos", t => t.MyKaoHeBiao_mkhbid)
                .Index(t => t.MyKaoHeBiao_mkhbid);
            
            CreateTable(
                "dbo.MyKaoHeBiao_one",
                c => new
                    {
                        oneid = c.Int(nullable: false, identity: true),
                        mbid = c.Int(nullable: false),
                        mbnr = c.String(),
                        sx = c.Int(nullable: false),
                        fz = c.Decimal(nullable: false, precision: 18, scale: 2),
                        htmlstr = c.String(),
                        mbtype = c.Int(nullable: false),
                        MyKaoHeBiao_mkhbid = c.Int(),
                    })
                .PrimaryKey(t => t.oneid)
                .ForeignKey("dbo.MyKaoHeBiaos", t => t.MyKaoHeBiao_mkhbid)
                .Index(t => t.MyKaoHeBiao_mkhbid);
            
            CreateTable(
                "dbo.MyKaoHeBiao_two",
                c => new
                    {
                        twoid = c.Int(nullable: false, identity: true),
                        mbid = c.Int(nullable: false),
                        mbnr = c.String(),
                        fz = c.Decimal(nullable: false, precision: 18, scale: 2),
                        sx = c.Int(nullable: false),
                        htmlstr = c.String(),
                        zf = c.Decimal(nullable: false, precision: 18, scale: 2),
                        gzjhkssj = c.DateTime(nullable: false),
                        gzjhwcsj = c.DateTime(nullable: false),
                        bz = c.String(),
                        MyKaoHeBiaoOne_oneid = c.Int(),
                    })
                .PrimaryKey(t => t.twoid)
                .ForeignKey("dbo.MyKaoHeBiao_one", t => t.MyKaoHeBiaoOne_oneid)
                .Index(t => t.MyKaoHeBiaoOne_oneid);
            
            CreateTable(
                "dbo.MyKaoHeBiao_twoPingFen",
                c => new
                    {
                        pfid = c.Int(nullable: false, identity: true),
                        pfusername = c.String(),
                        cjsj = c.DateTime(nullable: false),
                        fz = c.Decimal(nullable: false, precision: 18, scale: 2),
                        MyKaoHeBiaoTwo_twoid = c.Int(),
                    })
                .PrimaryKey(t => t.pfid)
                .ForeignKey("dbo.MyKaoHeBiao_two", t => t.MyKaoHeBiaoTwo_twoid)
                .Index(t => t.MyKaoHeBiaoTwo_twoid);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.MyKaoHeBiao_twoPingFen", "MyKaoHeBiaoTwo_twoid", "dbo.MyKaoHeBiao_two");
            DropForeignKey("dbo.MyKaoHeBiao_two", "MyKaoHeBiaoOne_oneid", "dbo.MyKaoHeBiao_one");
            DropForeignKey("dbo.MyKaoHeBiao_one", "MyKaoHeBiao_mkhbid", "dbo.MyKaoHeBiaos");
            DropForeignKey("dbo.MyKaoHeBiao_fujiaxiang", "MyKaoHeBiao_mkhbid", "dbo.MyKaoHeBiaos");
            DropIndex("dbo.MyKaoHeBiao_twoPingFen", new[] { "MyKaoHeBiaoTwo_twoid" });
            DropIndex("dbo.MyKaoHeBiao_two", new[] { "MyKaoHeBiaoOne_oneid" });
            DropIndex("dbo.MyKaoHeBiao_one", new[] { "MyKaoHeBiao_mkhbid" });
            DropIndex("dbo.MyKaoHeBiao_fujiaxiang", new[] { "MyKaoHeBiao_mkhbid" });
            DropTable("dbo.MyKaoHeBiao_twoPingFen");
            DropTable("dbo.MyKaoHeBiao_two");
            DropTable("dbo.MyKaoHeBiao_one");
            DropTable("dbo.MyKaoHeBiao_fujiaxiang");
            DropTable("dbo.MyKaoHeBiaos");
        }
    }
}
